<template>
  <div>
    <el-row>
      <el-col :span="24">
        <el-form :inline="true" class="demo-form-inline">
          <el-form-item>
            <el-input
              size="medium"
              v-model="queryStr"
              placeholder="查询"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button size="small" type="primary" icon="el-icon-search"
              >查询</el-button
            >
          </el-form-item>
          <el-form-item>
            <el-button
              size="small"
              @click="newest(1)"
              type="primary"
              icon="el-icon-circle-plus-outline"
              >新增</el-button
            >
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="24">
        <div>
          <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="date" label="制造商" width="">
            </el-table-column>

            <el-table-column prop="date1" label="生产日期" width="">
            </el-table-column>
            <el-table-column prop="name" label="质保到期" width="">
            </el-table-column>
            <el-table-column prop="address" label="专业类别"> </el-table-column>
            <el-table-column prop="address1" label="使用场合">
            </el-table-column>
            <el-table-column prop="address2" label="隶属系统">
            </el-table-column>
            <el-table-column prop="address2" label="备注"> </el-table-column>
            <el-table-column prop="address2" label="序列号"> </el-table-column>
            <el-table-column label="操作" width="320" align="center">
              <template #default="scope">
                <el-button size="mini" @click="arraycopy(scope.row)"
                  >复制序列号</el-button
                >

                <el-button
                  size="mini"
                  type="primary"
                  @click="editorPara(scope.row, 2)"
                  >编辑</el-button
                >
                <el-button
                  size="mini"
                  type="danger"
                  @click="deleted(scope.$index, scope.row)"
                  >封存</el-button
                >
                <el-button size="mini" type="danger">作废</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-col>
    </el-row>
    <el-dialog
      title="激活信息"
      v-model="plassets"
      width="35%"
      :close-on-click-modal="false"
    >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="销售合同">
          <el-select
            v-model="form.contract"
            style="width: 300px"
            placeholder="请选择"
          >
            <el-option
              v-for="item in productslisting"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="生产日期">
          <el-date-picker
            style="width: 300px"
            v-model="form.dates"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="质保到期时间">
          <el-date-picker
            style="width: 300px"
            v-model="form.datetime"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="制造商">
          <el-select
            v-model="form.manufacturers"
            style="width: 300px"
            placeholder="请选择"
          >
            <el-option
              v-for="item in getManufacturers"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="专业类别">
          <el-radio v-model="form.category" :label="1">综合</el-radio>
          <el-radio v-model="form.category" :label="2">软件</el-radio>
          <el-radio v-model="form.category" :label="1">机械</el-radio>
          <el-radio v-model="form.category" :label="2">电器电子</el-radio>
        </el-form-item>
        <el-form-item label="使用场合">
          <el-select
            v-model="form.getNam"
            style="width: 300px"
            placeholder="请选择"
          >
            <el-option
              v-for="item in occasion"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="隶属系统">
          <el-select
            v-model="form.membership"
            style="width: 300px"
            placeholder="请选择"
          >
            <el-option
              v-for="item in menu_report"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="备注">
          <el-input
            type="textarea"
            :rows="2"
            v-model="form.addnote"
            placeholder="备注"
          ></el-input>
        </el-form-item>

        <el-form-item label="附近上传">
          <el-upload
            class="upload-demo"
            action="https://jsonplaceholder.typicode.com/posts/"
            :on-preview="handlePreview"
            :on-remove="handleRemove"
            multiple
            :limit="3"
            :file-list="fileList"
          >
            <el-button size="small" type="primary">点击上传</el-button>
            <template #tip>
              <div class="el-upload__tip">
                只能上传 jpg/png 文件，且不超过 500kb
              </div>
            </template>
          </el-upload>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryStr: "",
      plassets: false,
      fileList: [],
      form: {
        contract: "",
        version: "", //版本
        dates: "", //时间
        datetime: "", //到期日期
        manufacturers: "", //制造商
        addnote: "",
        category: "",
        getNam: "",
        menu_report: "",
      },
      productslisting: [],
      getManufacturers: [],
      occasion: [],
      membership: [],
      tableData: [
        {
          date: "",
          name: "",
          date1: "",
          address: "xxxx",
          address1: "....",
          address2: "xxxxxxx",
        },
      ],
    };
  },
  methods: {
    newest() {
      this.plassets = true;
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    },
  },
};
</script>

<style scoped>
.addccc {
  margin-bottom: 20px;
}
</style>